package yyx;

import java.util.ArrayList;
import java.util.List;

public class one {
	public static void main(String[] args) {
		China china = new China("中国",960,100,20,140000000,99999,999);
		china.showInfo();
		china.developEconomy(1000);
		china.buildMilitary();
		china.startWar(10, 100);
		System.out.println("中国热爱和平，但有底线");
	}
}

class Country {

    String name;
    double territory;
    int army;
    int trade;
    int population;
    double money;
    int defense;

    public Country() {};
    public Country(String name, double territory, int army, int trade,int population,double money,int defense) {
        this.name = name;
        this.territory = territory;
        this.army = army; //军队数量
        this.trade = trade; //贸易的国家数
        this.population = population;
        this.money = money;
        this.defense = defense;
    }

    public void showInfo() {
        System.out.println("这个国家的名称为" + name);
        System.out.println("这个国家的领土为" + territory);
        System.out.println("这个国家的军队为" + army);
        System.out.println("这个国家的贸易为" + trade);
        System.out.println("这个国家的人口为" + population);
        System.out.println("这个国家的经济为" + money);
    }

    public void developEconomy(int tradeMoney) {
        this.money = this.money + trade * tradeMoney; //赚的钱数
        if(money > 1000) {
        	System.out.println("人口增加到原本的15%，即"+population*1.15+"人");
        }else if(money >500){
			System.out.println("人口增加到原本的7%，即"+population*1.07+"人");
		}else {
			System.out.println("人口基本没有变化，即"+population+"人");
		}
    }

    public void buildMilitary( ) {
        if(population*0.5 > 1000 && money > 1000) {
        	System.out.println("该国家创建了5支军队");
        	army += 5;
        }else if (population*0.5 >500 && money > 500) {
			System.out.println("该国家创建了3支军队");
		}else if (population*0.5 >100 && money > 100) {
			System.out.println("该国家创建了1支军队");
		}else {
			System.out.println("好像不太适合创建军队呢");
		}
    }

    public void startWar(int enemyArmy, int enemyDefense) {
        if(this.army < enemyArmy && this.defense < enemyDefense) {
        	System.out.println("别招惹人家，你打不过");
        }else if (this.army < enemyArmy && this.defense > enemyDefense) {
			System.out.println("可以守得住");
		}else if (this.army > enemyArmy && this.defense < enemyDefense) {
			System.out.println("数量上有一定优势");
		}else {
			System.out.println("快冲！拿下他！");
		}
    }

}
class China extends Country{

	public China(String name, double territory, int army, int trade, int population, double money, int defense) {
		super(name, territory, army, trade, population, money, defense);
		// TODO Auto-generated constructor stub
	}
	
}
